package com.pan.behavioral.visitor.pattern.part;

import com.pan.behavioral.visitor.pattern.Part;
import com.pan.behavioral.visitor.pattern.visit.FrameVisitor;

import javax.swing.*;
import java.awt.*;
import java.awt.image.BufferedImage;

public class ShapePart implements Part {

    @Override
    public void accept(FrameVisitor visitor) {

        JFrame frame = visitor.getFrame();
        BufferedImage image = new BufferedImage(50,50,BufferedImage.TYPE_INT_RGB);
        Graphics2D graphics = image.createGraphics();
        graphics.setColor(Color.RED);
        graphics.setFont(new Font("",Font.PLAIN,60));
        graphics.drawString("☭",0,50);
        JLabel jLabel = new JLabel(new ImageIcon(image));
        frame.add(jLabel);
    }
}
